﻿// -------------------------------------------------------------------------
//    @FileName         :    NFPkgMng.h
//    @Author           :    gaoyi
//    @Date             :    24-7-30
//    @Email            :    445267987@qq.com
//    @Module           :    NFPkgMng
//
// -------------------------------------------------------------------------

#pragma once

#include <NFComm/NFShmStl/NFShmVector.h>
#include "proto_cs_cmd.pb.h"
#include "proto_need.nanopb.h"

const int DEFAULT_MSG_CONTROL_INTERVAL = 10000;
const int DEFAULT_MSG_MIN_INTERVAL = 0;
const int DEFAULT_MSG_INTERVAL_LIMIT_COUNT = 100;

const int DEFAULT_MSG_STATISTIC_MIN_INTEVAL = 10000;
const int DEFAULT_MSG_STATISTIC_MAX_INTEVAL = 60000;

class NFPkgMng
{
public:
    NFPkgMng();
    
    virtual ~NFPkgMng();
    
    int CreateInit();
    int ResumeInit();

    int CheckPkgRate(int iMsgID, int &count, int &interval);
    int AddPkgStatistic(int iMsgID, uint64_t roleID, uint64_t uin);
private:
    NFShmVector<NFMsgInputInfo, proto_ff::E_CS_MAX_CMD_ID_VALUE> m_astInputInfo;
    NFShmVector<NFMsgInputStatistic, proto_ff::E_CS_MAX_CMD_ID_VALUE> m_msgStatisticInfo;
};